<?php
use yii\grid\GridView;
use backend\utils\XHtml;
use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '内容管理';
$this->params['breadcrumbs'][] = $this->title;
$catalog = new \common\models\Catalog();
?>
<?php $this->beginBlock('content-header'); ?>
<?= $this->title . ' ' . XHtml::create('内容') ?>
<?php $this->endBlock(); ?>

<div class="box box-primary">
    <div class="box-body">
        <form class="form-inline">
            <div class="form-group">
                <label class="control-label">标题</label>
                <?= Html::input('text', 'title', Yii::$app->request->get('title'), ['class' => 'form-control']) ?>
            </div>
            <div class="form-group">
                <label class="control-label">所属栏目</label>
                <?= Html::dropDownList('catalog_id', Yii::$app->request->get('catalog_id'), $catalog->getTrees(), ['prompt' => '选择栏目', 'class' => 'form-control']) ?>
            </div>
            <?= XHtml::submitButton('搜索') ?>
        </form>
    </div>
</div>

<div class="box box-primary">
    <div class="box-body">
        <?= GridView::widget([
            'dataProvider' => $dataProvider,
            'columns' => [
                'id',
                'title',
                [
                    'label' => '所属栏目',
                    'value' => 'catalog.name'
                ],
                'created_at:datetime',
                ['class' => backend\utils\XColumn::className()],
            ]
        ]); ?>
    </div>
</div>